package com.woniu.service.bean;

import com.woniu.util.ApplicationContextHolder;
import lombok.Data;

@Data
public class MessageReceivedCommand {

    private MessageReceivedCommandHandler handler;
    private Integer id;

    public MessageReceivedCommand() {
        this.handler = ApplicationContextHolder.getApplicationContext().getBean(MessageReceivedCommandHandler.class);
    }

    public MessageReceivedCommand(Integer id) {
        this();
        this.id = id;
    }

    public void execute() {
        handler.action(this);
    }

}
